import { Outlet } from "react-router-dom";
import { Alert } from "antd";

import "../index.css";

import useOnline from "../hooks/useOnline";
import PageHeader from "../components/Header";

const Root = () => {
  const online = useOnline();

  return (
    <>
      <PageHeader />
      <div className="wrapper">
        {online ? (
          <Alert message="Сеть подключена" type="success" showIcon closable/>
        ) : (
          <Alert message="Проблемы с сетью" type="error" showIcon closable/>
        )}
        <Outlet />
      </div>
    </>
  );
};

export default Root;
